package handler

import (
	"red-book-mgr/model"

	"github.com/gin-gonic/gin"
)

func List(c *gin.Context) {

	var book []model.Book

	err := model.DB.Find(&book).Error
	if err != nil {
		c.JSON(200, gin.H{
			"code": 500,
			"msg":  "获取列表失败",
		})
		return
	}

	c.JSON(200, gin.H{
		"code": 200,
		"msg":  "获取列表成功",
		"data": book,
	})
	return

}
